import request from '@/utils/request'

// 商机列表
export function getBusinessList(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/list',
    method: 'POST',
    data
  })
}
// 下拉选择商机列表
export function getBusinessSelect(data?: any) {
  return request({
    url: '/scrm-api/console/sale/business/drop-down-list',
    method: 'POST',
    data
  })
}
// 下拉选择商机流程
export function getWorkflowSelect(params?: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/select-workflow',
    params
  })
}
// 下拉商机流程阶段
export function getProcessSelect(params: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/select-stage',
    params
  })
}
// 商机列表-导出
export function businessExport(data?: any) {
  return request({
    url: '/scrm-api/console/sale/business/list-export',
    method: 'POST',
    data
  })
}
// 商机列表-添加跟进
export function addFollow(data?: any) {
  return request({
    url: '/scrm-api/console/sale/business/add_follow',
    method: 'POST',
    data
  })
}
// 商机审核
export function businessAudit(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/audit',
    method: 'POST',
    data
  })
}
// 商机审核-重新提交审核
export function businessSubAudit(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/sub-audit',
    method: 'POST',
    data
  })
}

// 新建商机
export function businessCreate(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/create',
    method: 'POST',
    data
  })
}
// 编辑商机
export function businessEdit(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/edit',
    method: 'POST',
    data
  })
}
// 查看商机
export function businessInfo(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/info',
    method: 'POST',
    data
  })
}
// ----------------------------------------------------------详情商机----------------------------------------------------------
// 详情数据
export function businessDetail(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/detail',
    method: 'POST',
    data
  })
}

// 详情商机-聊天记录
export function businessDetailChat(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/chat-list',
    method: 'POST',
    data
  })
}
// 详情商机-跟进记录
export function businessAddFollow(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/add_follow',
    method: 'POST',
    data
  })
}
// 商机列表阶段变更
export function businessStage(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/change_stage',
    method: 'POST',
    data
  })
}
// 商机列表-流程列表
export function businessWorkflowList(data: any) {
  return request({
    url: '/scrm-api/console/sale/business/list-by-workflow',
    method: 'POST',
    data
  })
}
//商机统计
export function businessStaticNum(data: any) {
  return request({
    url: '/scrm-api/console/customer/business-statistics',
    method: 'POST',
    data
  })
}
// ------------------------------------商机流程------------------------------------
// 流程列表
export function getWorkflowList(data: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/list',
    method: 'POST',
    data
  })
}
// 开启/关闭
export function workflowOperate(data: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/operate',
    method: 'POST',
    data
  })
}
// 删除
export function workflowDelete(data: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/del',
    method: 'POST',
    data
  })
}
// 新建流程
export function workflowAdd(data: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/add',
    method: 'POST',
    data
  })
}
// 查看流程
export function workflowInfo(params?: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/detail',
    params
  })
}
// 编辑流程
export function workflowEdit(data: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/edit',
    method: 'POST',
    data
  })
}
// 获取规则配置
export function getWorkflowRules(params?: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/rule-config',
    params
  })
}
// 设置规则配置
export function WorkflowSettingRules(data?: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/rule-setting',
    method: 'POST',
    data
  })
}
// 规则详情
export function geRuleDetail(params?: any) {
  return request({
    url: '/scrm-api/console/sale/business-workflow/rule-detail',
    params
  })
}
// --------------------------------输单--------------------------------
// 输单列表
export function getLoseList(params?: any) {
  return request({
    url: '/scrm-api/console/sale/lose-cause/list',
    params
  })
}
// 新建输单原因
export function loseAdd(data?: any) {
  return request({
    url: '/scrm-api/console/sale/lose-cause/add',
    method: 'POST',
    data
  })
}
// 编辑输单原因
export function loseEdit(data?: any) {
  return request({
    url: '/scrm-api/console/sale/lose-cause/edit',
    method: 'POST',
    data
  })
}
// 删除输单原因
export function loseDel(data?: any) {
  return request({
    url: '/scrm-api/console/sale/lose-cause/del',
    method: 'POST',
    data
  })
}
// 输单原因排序
export function loseRank(data?: any) {
  return request({
    url: '/scrm-api/console/sale/lose-cause/rank',
    method: 'POST',
    data
  })
}
// 输单原因排序
export function loseStatus(data?: any) {
  return request({
    url: '/scrm-api/console/sale/lose-cause/operate',
    method: 'POST',
    data
  })
}
